package com.atguigu.gulimall.product.feign;

import com.atguigu.common.to.SkuReductionTo;
import com.atguigu.common.to.SpuBoundTo;
import com.atguigu.common.utils.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * @author durant
 * @create 2021-12-08 10:59
 * @Description:
 */
@FeignClient("gulimall-coupon")
public interface CouponFeignService {
    // spring cloud 远程调用的逻辑

    /**
     * 1. CouponFeignService.saveSpuBounds ()
     *     1.1 当有这个@RequestBody注解时，将这个传入的对象转为json
     *     1.2 找到gulimall-coupon服务，给/coupon/spubounds/save发送请求，，将json放在请求体位置
     *     1.3 对方服务收到请求
     * @param spuBoundTo
     * @return
     */
    @PostMapping("/coupon/spubounds/save")
    R saveSpuBounds(@RequestBody SpuBoundTo spuBoundTo);
    @PostMapping("/coupon/skufullreduction/saveInfo")
    R saveSkuReduction(@RequestBody SkuReductionTo skuReductionTo);
}
